"""
    author:kapri.Chen
    time:2021-11-06  9:56
    project:1 
    
"""

print("---------------------welcome to our mall--------------------")
username=input("please input your username:")
passwd=input("please input your passwd:")
user_massage={'cym':{'passwd':'11223','money':0},'hj':{'passwd':'3333','money':0}}
goods={'0001':{'num':'香蕉','price':14},'0002':{'num':'苹果','price':30}}
shop_log={}
if username in user_massage and passwd==user_massage[username]['passwd']:
    print(username, 'logging succese!')
    print(goods)
    lo=''
    user_massage[username]['money'] = int(input("告诉我你的预算吧："))
    while 1:
        g_num=input("请输入你要购买的物品代码(输入exit退出)：")
        if g_num == 'exit':
            break
        q = input("请输入你要购买的的数量：")
        if q == 'exit':
            break
        elif user_massage[username]['money']>int(q)*goods[g_num]['price'] :
            user_massage[username]['money']-=int(q)*goods[g_num]['price']
            shop_log['goods']=goods[g_num]['num']
            shop_log['nu']=int(q)
            lo+=str(goods[g_num]['num'])+' '
            print('已购买：',lo)
        elif user_massage[username]['money']<int(q)*goods[g_num]['price'] :
            print(f"钱不够了！！你只有{user_massage[username]['money']}元！")

    print(f"你购买了{lo}\n余额{user_massage[username]['money']}元")